package ch00.a6;

/**
 * @description: 类描述
 * @author: Fesine
 * @createTime:2016/7/12 23:19
 * @update:修改内容
 * @author: Fesine
 * @updateTime:2016/7/12 23:19
 */
public class Dog {
    private String name;

    private int shoutNum = 3;


    public Dog(String name) {
        this.name = name;
    }

    public Dog() {
        this.name = "无名";
    }

    public int getShoutNum() {
        return shoutNum;
    }

    public void setShoutNum(int shoutNum) {
        if (shoutNum <= 10) {
            this.shoutNum = shoutNum;
        } else {
            this.shoutNum = 10;
        }
    }

    public String shout() {
        String result = "";
        for (int i = 0; i < shoutNum; i++) {

            result += "旺 ";
        }
        return "我的名字叫:" + name + " " + result;
    }

    public static void main(String[] args) {
        Dog dog = new Dog();
        dog.setShoutNum(15);
        System.out.println(dog.shout());
    }
}
